package com.itheima.mapper;

import com.itheima.pojo.Dept;
import com.itheima.pojo.DeptLog;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Mapper
public interface DeptMapper {
    //部门的Mapper接口

    //查询部门列表
    @Select("select * from dept")
    public List<Dept> list();

    //根据id删除部门
    @Select("delete from dept where id = #{id}")
    void delete(int id);

    //添加部门
    @Insert("insert into dept (name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    void add(@RequestBody Dept dept);

    //根据id 查询部门信息
    @Select("select id, name, create_time, update_time from dept where id = #{id}")
    public Dept query(int id);


    //修改部门信息
    void update(Dept dept);

    //添加日志
//    @Insert("insert into dept_log (create_time, description) values(#{createTime},#{description})")
    void addDeptLog(DeptLog deptLog);
}
